/*
** dsp.h
**
** This module contains function to display the entities.
**
** TeCGraf - Grupo de Tecnologia em Computacao Grafica - PUC-Rio.
**
** Created in 16 Jan 92 by Celes and LFMartha.
**
** Modified on 08-Feb-95 by LFMartha.
**     Created function DspRlibRawVertex.
**
** Modified on 03-May-98 by LFMartha.
**     Added maximum local moment parameter in function DspResEffDiagr.
**
** Modified on 15-Feb-2000 by LFMartha.
**     Version 2.06: Created spring supports.
**     Got rid of function DspLineSupp that was not used.
**     Created function DspThermalLoad.
**     Created function DspUtlWnSize (replaced local function 
**     DspWnSize in file dsp.c).
**     Added text size argument to load, reaction, etc. display functions.
**     Created functions DspSpringKxVal, DspSpringKyVal, and
**     DspSpringKzVal to display spring stiffness values.
**
** Modified on 14-Jan-2001 by LFMartha.
**     Version 2.09:
**     Deleted functions DspEdge and DspVertex.
**     Deleted function DspRlibVertex and renamed function
**     DspRlibRawVertex to DspRlibVertex.
**     Created global variable to hold display sizes.
**     Deleted size arguments in display functions.
**     Created function DspUtlVertRotLibAllEdges.
**     Created function DspUtlChkPltSup.
**     Created functions DspUtlUpdateSizes and DspUtlEdgeOffsets.
**     Created functions DspUtlOffsetShift and DspUtlOffsetUnShift.
**     Added offset parameters to functions DspResEffDiagr,
**     DspResValue, DspSupPrescrDispl, and DspSupReact.
**     Created global function DspUtlDefOrientation, replacing
**     local functions called DefOrientation in some modules.
**     Created function DspMEndMomLoad.
**
** Modified on 15-Oct-2001 by LFMartha.
**     Version 2.10:
**     When created influence line response mode.
**     Created function DspResILDiagr.
**
** Modified on 13-Feb-2002 by LFMartha.
**   Version 2.11: 
**     Created function DspUtlChkHomogVert to test for homogeneous
**     vertex (exactly two adjacent and aligned edges).
**     Created function DspUtlChkEqualResVal to test for equal
**     result value at a common vertex between to edges.
**     Added end values text alignment parameters in functions
**     DspResEffDiagr and DspResILDiagr.
**
*/


#ifndef dsp_h
#define dsp_h

#define TOLELL 0.005

#define TOLERL 0.03

#include "hed.h"
#include "gra.h"


/* Define system - global or local */
typedef enum tsystem
{
  GLOBALSYS,
  LOCALSYS
} Tsystem;

/* Macro definitions for display characteristic factors
 */
#define DSP_ARROW_FAC    (0.02000)   /* arrow characteristic factor */
#define DSP_VHINGE_FAC   (0.01200)   /* vertex hinge characteristic factor */
#define DSP_EHINGE_FAC   (0.00960)   /* edge hinge characteristic factor */
#define DSP_RIGTHICK_FAC (0.00600)   /* rigid edge characteristic factor */
#define DSP_SUPPORT_FAC  (0.02500)   /* support characteristic factor */
#define DSP_SUPPLT_FAC   (0.01875)   /* rot. sup. box characteristic factor */
#define DSP_NFORCE_FAC   (0.04500)   /* nodal force characteristic factor */
#define DSP_MOMENT_FAC   (0.02250)   /* moment characteristic factor */
#define DSP_MLOAD_FAC    (0.05000)   /* member load characteristic factor */ 
#define DSP_TEXT_FAC     (0.01200)   /* text characteristic factor */

/* Display global variables
 */
#ifdef _DSP_C
double   dsp_sizew;        /* window characteristic size */
double   dsp_sizear;       /* arrow characteristic size */
double   dsp_sizevrl;      /* vertex hinge characteristic size */
double   dsp_sizeerl;      /* edge hinge characteristic size */
double   dsp_sizergth;     /* rigid edge characteristic thickness */
double   dsp_sizesup;      /* support characteristic size */
double   dsp_sizeplt;      /* rot.sup. box (plate) characteristic size */
double   dsp_sizenf;       /* nodal force characteristic size */
double   dsp_sizemom;      /* moment characteristic size */
double   dsp_sizel;        /* member load characteristic size */ 
double   dsp_sizetxt;      /* text characteristic size */
#else
extern double   dsp_sizew;        /* window characteristic size */
extern double   dsp_sizear;       /* arrow characteristic size */
extern double   dsp_sizevrl;      /* vertex hinge characteristic size */
extern double   dsp_sizeerl;      /* edge hinge characteristic size */
extern double   dsp_sizergth;     /* rigid edge characteristic thickness */
extern double   dsp_sizesup;      /* support characteristic size */
extern double   dsp_sizeplt;      /* rot.sup. box (plate) characteristic size */
extern double   dsp_sizenf;       /* nodal force characteristic size */
extern double   dsp_sizemom;      /* moment characteristic size */
extern double   dsp_sizel;        /* member load characteristic size */ 
extern double   dsp_sizetxt;      /* text characteristic size */
#endif

/* Exported functions prototypes
 */

/* module "dspsupp.cpp" */
void DspSupport       (int , Tpoint *, double, int );
void DspMemberSupport (int,	int ,Tpoint *, double, double, int);
void DspSpringKxVal( Tpoint *p, double kx, int c );
void DspSpringKyVal( Tpoint *p, double ky, int c );
void DspSpringKzVal( Tpoint *p, double kz, int c );

/* module "dsprlib.cpp" */
void DspRlibVertex ( int, HedVertex *, int );

/* module "dspload.cpp" */
void  DspLoadNod         (Tpoint *, double, double, double, int );
void  DspSupPrescrDispl  (Tpoint *, double, double, double, double, double, int );
void  DspConstLoadMember (int , Tpoint *, Tsystem, double, double, double, int );
void  DspSupReact        (Tpoint *, double, double, double, double, double, int );
void  DspThermalLoad     (Tpoint *pi, Tpoint  *pj, double top, double bot, 
                          int color );
void  DspMEndMomLoad     (Tpoint *pi, Tpoint  *pj, double ma, double mb, 
                          int color );

/* module "dsputl.cpp" */
void   DspUtlChangeSystemGL  ( double, double, Tpoint *, int );
void   DspUtlChangeSystemLG  ( double, double, Tpoint *, Tpoint *, int );
double DspUtlArcTg           ( double, double );
void   DspUtlRotationPoints  ( double, Tpoint *, Tpoint *, int );
void   DspUtlMatrixMultVector( int, int, int, double [3][3], double [3],
			       double [3] );
void   DspUtlArrow           ( Tpoint *, Tpoint *, int );
double DspUtlWnSize          ( void );
void   DspUtlUpdateSizes     ( void );
int    DspUtlVertRotLibAllEdges( HedVertex *v );
int    DspUtlChkPltSup       ( HedVertex *v );
int    DspUtlDefOrientation  ( double dx, double dy );
void   DspUtlEdgeOffsets     ( HedEdge *e, double *offset1, double *offset2 );
double DspUtlOffsetShift     ( double x, double l, double o1, double o2 );
double DspUtlOffsetUnShift   ( double ox, double l, double o1, double o2 );
int    DspUtlChkHomogVert    ( HedVertex *vtx, HedEdge **e1, HedEdge **e2 );
int    DspUtlChkEqualResVal  ( HedVertex *vtx, HedEdge *e1, HedEdge *e2, double *val );

void   DspFindFreeRegion     (HedVertex *v, double *initial, double *final);


#endif
